package com.itheima.d3_abstract;

public class Test3 {
    public static void main(String[] args) {
        String payWay="";
        OnlinePay purchase;
        if(payWay.equals("ABC")){
             purchase=new ABC();
        }else if(payWay.equals("WeChat")){
             purchase=new WeChat();
        }else {
             purchase=new WorkBank();
        }

        purchase.pay();
    }
}
abstract class OnlinePay{

    abstract public void pay();
}

class ABC extends OnlinePay{
    @Override
    public void pay() {
        System.out.println("农业银行pay");
    }
}
class WeChat extends  OnlinePay{
    @Override
    public void pay() {
        System.out.println("微信支付pay");
    }
}
class WorkBank extends  OnlinePay{
    @Override
    public void pay() {
        System.out.println("工商银行pay");
    }
}